Source File
utils.go
Belonging Package
github.com/Nerzal/gocloak/v13
package gocloakimport ()type contextKey stringvar tracerContextKey = contextKey("tracer")// StringP returns a pointer of a string variablefunc ( string) *string {return &}// PString returns a string value from a pointerfunc ( *string) string {if == nil {return ""}return *}// BoolP returns a pointer of a boolean variablefunc ( bool) *bool {return &}// PBool returns a boolean value from a pointerfunc ( *bool) bool {if == nil {return false}return *}// IntP returns a pointer of an integer variablefunc ( int) *int {return &}// Int32P returns a pointer of an int32 variablefunc ( int32) *int32 {return &}// Int64P returns a pointer of an int64 variablefunc ( int64) *int64 {return &}// PInt returns an integer value from a pointerfunc ( *int) int {if == nil {return 0}return *}// PInt32 returns an int32 value from a pointerfunc ( *int32) int32 {if == nil {return 0}return *}// PInt64 returns an int64 value from a pointerfunc ( *int64) int64 {if == nil {return 0}return *}// Float32P returns a pointer of a float32 variablefunc ( float32) *float32 {return &}// Float64P returns a pointer of a float64 variablefunc ( float64) *float64 {return &}// PFloat32 returns an flaot32 value from a pointerfunc ( *float32) float32 {if == nil {return 0}return *}// PFloat64 returns an flaot64 value from a pointerfunc ( *float64) float64 {if == nil {return 0}return *}// NilOrEmpty returns true if string is empty or has a nil valuefunc ( *string) bool {return == nil || len(*) == 0}// NilOrEmptyArray returns true if string is empty or has a nil valuefunc ( *[]string) bool {if == nil || len(*) == 0 {return true}return (*)[0] == ""}// DecisionStrategyP returns a pointer for a DecisionStrategy valuefunc ( DecisionStrategy) *DecisionStrategy {return &}// LogicP returns a pointer for a Logic valuefunc ( Logic) *Logic {return &}// PolicyEnforcementModeP returns a pointer for a PolicyEnforcementMode valuefunc ( PolicyEnforcementMode) *PolicyEnforcementMode {return &}// PStringSlice converts a pointer to []string or returns ampty slice if nill valuefunc ( *[]string) []string {if == nil {return []string{}}return *}// NilOrEmptySlice returns true if list is empty or has a nil valuefunc ( *[]string) bool {return == nil || len(*) == 0}// WithTracer generates a context that has a tracer attachedfunc ( context.Context, opentracing.Tracer) context.Context {return context.WithValue(, tracerContextKey, )}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |